Locks in Database

Hi,

I am trying to create a script that would send out emails to users with locks in modules. It sends out emails to the users with locks in modules but when I add a group (Administrators to also receive the emails the Administrators don't get it, only the users holding the locks in the module receive them, the following is a piece of the script where I think the problem is, can anyone tell me what the problem may be?

for lockItem in lcklist do { 
        username = lockItem.user
                ld = lockItem.date
                logDate = dateOnly(ld)""
                todayDate = dateOnly(today)""
 
                User u = find(username)
                uEmail = u.email
                put(uName, uEmail, uEmail)
 
                Group g = find("Administrators group")//I also want to send this group an email
                u
                for u in g do{
                uEmail = u.email
                put(uName, uEmail, uEmail)
                }
        }
                
                for uEmail in uName do{
                Skip emailTo = create
                //put (emailTo, 1, sFrom)
                put (emailTo, 2, uEmail[0:])
 
                sMsg = "DOORS User," nL nL//-
                "Message" nL nL //-
                "mailto:"sFrom""
 
                sendEMailNotification(sFrom, emailTo, sSub, sMsg)
                delete(emailTo)
                
 
        }

SystemAdmin - Tue Aug 21 13:35:28 EDT 2012

Re: Locks in Database
SystemAdmin - Tue Aug 21 15:08:06 EDT 2012

Hi,

I assume uName is of type Skip.
Could it be that you created it by "create" instead of "createString"?
Is this single "u" in line 12 is really in your code?
Rgds,
Mike

Re: Locks in Database
llandale - Tue Aug 21 16:41:09 EDT 2012

I like the guess that you used "create" instead of "createString".

Perhaps you mis-spelled "Administrators Group" or you lack "R" access to it's contents. Perhaps the admins have not specified their emails.

Sure seems to me you want a single Email to go out to everybody. Seems in this case the Admins are going to get an email that simply says someone has something locked.

-Louie

Re: Locks in Database
Mathias Mamsch - Tue Aug 21 16:57:14 EDT 2012

I have another guess. You are falling for auto-declare mischief! Since you are only declaring a few variables in your code, my guess is that you have auto-declare turned on and DXL will make the following from your code!

Group g = find("Administrators group")//I also want to send this group an email
 
for u in g do{
  UserRef__ uEmail = u.email
  put(uName, uEmail, uEmail)
}

what you would want is:

Group g = find("Administrators group")//I also want to send this group an email
 
for u in g do{
  string uEmail = u.email
  put(uName, uEmail, uEmail)
}

Explanation: The "." syntax in DXL is not a feature of the language. Instead it is enabled by undocumented types and operators. So the following functions make sure that you can user user.email:

UserRef__ ::. (User, UserElement) // extracts the requested property from the User 
UserElement email ()    // stores the info that we want the email property
string ::= (string &s, UserRef__ x)  // assign a UserRef to a string
 
string s = user.email is translated to ::= (string &s, UserRef__ ::. (User user, UserElement email()))

If you do NOT declare uEmail the DXL parser cannot possibly know what you want here. Therefore instead of putting strings to your skip you will be putting UserRef__ objects to your Skip. So try declaring all your variables, turn autodeclare off (look in the forum) and try again.

Maybe that helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Locks in Database
SystemAdmin - Tue Aug 28 10:15:34 EDT 2012

llandale - Tue Aug 21 16:41:09 EDT 2012
I like the guess that you used "create" instead of "createString".

Perhaps you mis-spelled "Administrators Group" or you lack "R" access to it's contents. Perhaps the admins have not specified their emails.

Sure seems to me you want a single Email to go out to everybody. Seems in this case the Admins are going to get an email that simply says someone has something locked.

-Louie

Hi,

It works, just a mispelling error, however I want the email to have all the names that it went to in the "TO". I want the Administrators to know everyone the emails went out to. Right now the "To" just has the name of the person receiving the email.

Re: Locks in Database
SystemAdmin - Tue Aug 28 10:36:17 EDT 2012

SystemAdmin - Tue Aug 28 10:15:34 EDT 2012
Hi,

It works, just a mispelling error, however I want the email to have all the names that it went to in the "TO". I want the Administrators to know everyone the emails went out to. Right now the "To" just has the name of the person receiving the email.

Ok, I got it working.

Thanks!!